#pragma once

//Class Definition//
class CTile
{
private:
	//Tile Variables-----------------------------------------------//
	int		m_Highlight;	//Is this Tile Highlighted right now?//
	float	m_X, m_Z;		//Position in 3D space// Y is always the same//

	TileCondition	m_Condition;
	TileType		m_Type;
	SlideType		m_Slide;

	//Tile Functions-----------------------------------------------//
public:
	//Contructor//
	CTile()
	{
		m_Highlight = 0;
		m_X = 0.0f; m_Z = 0.0f;
		m_Condition = EMPTY;
		m_Type = MAIN;
		m_Slide = NORMAL;
	}
	void HighlightOn(void)
	{
		m_Highlight = 1;
	}
	void HighlightOff(void)
	{
		m_Highlight = 0;
	}
	void SetPosition(D3DXVECTOR3 newPosition)
	{
		m_X = newPosition.x;
		m_Z = newPosition.z;
	}
	void SetPosition(float newX, float newZ)
	{
		m_X = newX; 
		m_Z = newZ;
	}
	void SetTileCondition(TileCondition newCondition)
	{
		if(newCondition >= P0 && newCondition <= EMPTY)
		{
			m_Condition = newCondition;
		}
		else
		{
			::MessageBoxA(NULL, "Bad Number Passed to Set Tile Condition", "SetTileCondition(bad)", MB_OK | MB_ICONERROR);
			m_Condition = EMPTY;
		}
	}

	void SetTileType(TileType newType)
	{
		if(newType >= P0START && newType <= MAIN)
		{
			m_Type = newType;
		}
		else
		{
			::MessageBoxA(NULL, "Bad Number Passed to Set Tile Type", "SetTileType(bad)", MB_OK | MB_ICONERROR);
			m_Type = MAIN;
		}
	}

	void SetSlideType(SlideType newSlideType)
	{
		if(newSlideType >= START0 && newSlideType <= NORMAL)
		{
			m_Slide = newSlideType;
		}
		else
		{
			::MessageBoxA(NULL, "Bad Number Passed to Set Slide Type", "SetTileType(bad)", MB_OK | MB_ICONERROR);
			m_Slide = NORMAL;
		}
	}

	void InitTile(float newX, float newZ, int newTileCondition, int newTileType, int newSlideType)
	{
		//Calls all those other functions I made using the values passed in//
		this->SetPosition(newX, newZ);
		this->SetTileCondition(TileCondition(newTileCondition));
		this->SetTileType(TileType(newTileType));
		this->SetSlideType(SlideType(newSlideType));
		//We're assuming no tiles will be highlighted right now//
		this->HighlightOff();
	}

	TileCondition getTileCondition(void)
	{
		return m_Condition;
	}

	TileType getTileType(void)
	{
		return m_Type;
	}

	SlideType getSlideType(void)
	{
		return m_Slide;
	}

	bool getHightlight(void)
	{
		if(m_Highlight == 0)
			return false;
		return true;
	}

	float getX(void)
	{
		return m_X;
	}

	float getZ(void)
	{
		return m_Z;
	}

	D3DXVECTOR3 getTilePos(void)
	{
		D3DXVECTOR3 temp;
		temp.x = m_X;
		temp.y = 0;
		temp.z =m_Z;
		return temp;
	}
};

class CSpecialTile: public CTile
{
private:
	//Start Tile Variables-----------------------------------------//
	int m_PlayerID;		//The Player that owns this START tile//
	int m_PawnCount;	//The number of pawns on this START tile//
public:
	//Start Tile Functions-----------------------------------------//
	void SetPlayerID(int newPlayerID)
	{
		m_PlayerID = newPlayerID;
	}
	void SetPawnCount(int newPawnCount)
	{
		m_PawnCount = newPawnCount;
	}
	void IncrementPawnCount(void)
	{
		m_PawnCount++;	//plus one to pawn count//
	}
	void DecrementPawnCount(void)
	{
		m_PawnCount--;	//minue one to pawn count//
	}
	
};
